<template>
  <div class="resume">
    <div class="banner"></div>

    <div class="profile">
      <div class="profile-header">
        <div class="profile-header__title">
          <h1>我的简历</h1>
          <div class="span">
            <label>
              <i class="el-icon-time"></i>
              最近更新:
            </label>
            <time> {{ resumeDetail.updateTime }}</time>
          </div>
        </div>

        <div class="profile-header__add-button" v-if="!this.hasResume">
          <router-link to="/resumeAdd">
            <el-button plain round icon="el-icon-edit">新增</el-button>
          </router-link>
        </div>

        <div class="profile-header__editor-button" v-if="this.hasResume">
          <router-link to="/resumeEdit">
            <el-button plain round icon="el-icon-edit">编辑</el-button>
          </router-link>
        </div>
      </div>

      <div class="resumeForm">
        <!-- 基本信息 -->
        <div class="resumeViewSection">
          <h2 class="resumeViewSection__title">基本信息</h2>

          <div class="resumeViewForm">
            <div class="resumeViewItem">
              <div class="resumeViewItem__label">姓名</div>
              <div class="resumeViewItem__content">
                {{ resumeDetail.name }}
              </div>
            </div>
            <div class="resumeViewItem">
              <div class="resumeViewItem__label">手机号</div>
              <div class="resumeViewItem__content">
                {{ resumeDetail.phone }}
              </div>
            </div>
            <div class="resumeViewItem">
              <div class="resumeViewItem__label">邮箱</div>
              <div class="resumeViewItem__content">
                {{ resumeDetail.email }}
              </div>
            </div>
            <div class="resumeViewItem">
              <div class="resumeViewItem__label">生日</div>
              <div class="resumeViewItem__content">
                {{ resumeDetail.birthday }}
              </div>
            </div>
            <div class="resumeViewItem">
              <div class="resumeViewItem__label">性别</div>
              <div class="resumeViewItem__content" v-show="resumeDetail.gender">
                女
              </div>
              <div class="resumeViewItem__content" v-show="!resumeDetail.gender">
                男
              </div>
            </div>
            <div class="resumeViewItem">
              <div class="resumeViewItem__label">婚姻情况</div>
              <div class="resumeViewItem__content" v-show="resumeDetail.marry">
                已婚
              </div>
              <div class="resumeViewItem__content" v-show="!resumeDetail.marry">
                未婚
              </div>
            </div>
          </div>
        </div>
        <!-- 核心信息 -->
        <div
            class="resumeViewSection"
        >
          <h2 class="resumeViewSection__title">核心信息</h2>

          <div
              class="resumeViewForm clearfix"
          >
            <div class="resumeViewItem">
              <div class="resumeViewItem__label">求职意向</div>
              <div class="resumeViewItem__content"> {{ resumeDetail.aimJobPosition }}</div>
            </div>
            <div class="resumeViewItem">
              <div class="resumeViewItem__label">期望城市</div>
              <div class="resumeViewItem__content">
                {{ resumeDetail.desiredWorkplace }}
              </div>
            </div>
            <div class="resumeViewItem">
              <div class="resumeViewItem__label">工作经验</div>
              <div class="resumeViewItem__content"> {{ resumeDetail.experience }}</div>
            </div>
            <div class="resumeViewItem">
              <div class="resumeViewItem__label">毕业院校</div>
              <div class="resumeViewItem__content"> {{ resumeDetail.graduated }}</div>
            </div>
            <div class="resumeViewItem ">
              <div class="resumeViewItem__label">籍贯</div>
              <div class="resumeViewItem__content"> {{ resumeDetail.habitation }}</div>
            </div>
            <div class="resumeViewItem ">
              <div class="resumeViewItem__label">岗位类别</div>
              <div class="resumeViewItem__content"> {{ resumeDetail.jobCategory }}</div>
            </div>
            <div class="resumeViewItem ">
              <div class="resumeViewItem__label">专业</div>
              <div class="resumeViewItem__content"> {{ resumeDetail.major }}</div>
            </div>
            <div class="resumeViewItem ">
              <div class="resumeViewItem__label">兴趣爱好</div>
              <div class="resumeViewItem__content"> {{ resumeDetail.personalIntroduction }}</div>
            </div>
            <div class="resumeViewItem ">
              <div class="resumeViewItem__label">薪资要求</div>
              <div class="resumeViewItem__content"> {{ resumeDetail.salaryRequire }}</div>
            </div>
            <div class="resumeViewItem ">
              <div class="resumeViewItem__label">技能</div>
              <div class="resumeViewItem__content"> {{ resumeDetail.skill }}</div>
            </div>
          </div>
        </div>


      </div>
    </div>
  </div>
</template>
<script>

export default {
  name: "resume",
  data() {
    return {
      resumeDetail: {},
      hasResume:false
    };
  },
  mounted() {
    this.getHasResume()
    this.getMyResume()
  },
  methods: {
    async getMyResume() {
      try {
        await this.$store.dispatch('getMyResume')
        this.resumeDetail = this.$store.state.resume.myResume
      } catch (e) {
        console.log(e)
      }
    },
    async getHasResume() {
      try {
        await this.$store.dispatch('getHasResume')
        this.hasResume = this.$store.state.resume.hasResume.hasResume
        if (!this.hasResume){
          this.$notify({
            title: '警告',
            message: '请点击新增按钮填写简历',
            type: 'warning'
          });
        }
      } catch (e) {
        console.log(e)
      }
    },
  },
};
</script>

<style lang="less" scoped>
h1 {
  color: #fff;
  height: 59px;
  line-height: 59px;
  font-size: 30px;
  font-weight: 800;
}

.profile-header__add-button{

}

.span {
  font-size: 16px;
}

.banner {
  // width: 1200px;
  background-image: url("//sf1-ttcdn-tos.pstatp.com/obj/ttfe/ATSX/my_resume_banner_1577084307030.jpg");
  background-size: 100% 100%;
  height: 300px;
  background-repeat: no-repeat;
}

.profile {
  width: 900px;
  margin: auto;
  margin-top: -200px;

  &-header {
    color: #fff;
    display: flex;
    justify-content: space-between;

    align-items: center;
  }

  .resumeForm {
    margin-top: 30px;
    background: #fff;
    box-shadow: 0px 9px 20px 0px #c2c1c180;
    border-radius: 4px;
    padding: 30px;

    .resumeViewSection {
      min-height: 300px;
      margin-bottom: 30px;

      &__title {
        position: relative;
        height: 32px;
        margin-bottom: 38px;
        font-size: 20px;
        font-weight: 800;
        line-height: 1.6;
        color: #1f2329;
      }

      .resumeViewForm {
        margin-bottom: 30px;
      }

      .resumeViewItem {
        float: left;
        width: 50%;
        margin-bottom: 20px;
        min-height: 50px;

        &__resumeAttachment {
          display: flex;
          padding: 10px;
          background-color: #3370ff;
          align-items: center;

          time {
            //color: @regular-text-color;
            //font-size: @font-size-base;
          }

          .fileIcon {
            margin-right: 10px;
            width: 50px;
            height: 50px;
          }

          .download-link {
            margin-left: auto;

            .el-icon-download {
              //font-size: @font-size-large;
              border-radius: 50%;
              //border: 1px solid @border-base-color;
              padding: 4px;
            }

            &:hover {
              //color: @main-color;
            }
          }
        }

        &__content.is-link {
          //color: @main-color;
          cursor: pointer;
        }

        &__label {
          margin-bottom: 4px;
          height: 24px;
          font-size: 14px;
          font-weight: 500;
          line-height: 1.71;
          color: #1f2329;
          opacity: .45;
        }

        &__content {
          word-wrap: break-word;
          font-size: 16px;
          line-height: 1.75;
          color: #1f2329;
        }

        &__content-link {
          //color: @main-color;
        }

        &-desc {
          overflow: hidden;
          width: 70%;
          white-space: pre-line;
        }
      }
    }
  }
}
</style>